SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE FUNCTION [dbo].[SP_org]  ()
RETURNS int
AS
BEGIN
   DECLARE @org AS INT
   SELECT @org= organizacion from tb_reparticiones 
where idreparticion = 
(select idreparticion from tb_usuarios where ntuser = system_user)
   RETURN(@org)
END
GO
